using System;
using System.Collections.Generic;
using System.Net;

namespace Kannon.Core
{
    public class HttpRequestHeaderCollection : HttpHeaderCollection<HttpRequestHeader>
    {
        //
        // This is taken verbatim from System.Net.UnsafeNclNativeMethods+HttpApi+HTTP_REQUEST_HEADER_ID.
        // If only Microsoft annotated HttpResponseHeader members with some kind of description attribute...
        private static readonly string[] HttpRequestHeaders = { 
            "Cache-Control", "Connection", "Date", "Keep-Alive", "Pragma", "Trailer", "Transfer-Encoding", "Upgrade", "Via", "Warning", "Allow", "Content-Length", 
            "Content-Type", "Content-Encoding", "Content-Language", "Content-Location", "Content-MD5", "Content-Range", "Expires", "Last-Modified", "Accept", 
            "Accept-Charset", "Accept-Encoding", "Accept-Language", "Authorization", "Cookie", "Expect", "From", "Host", "If-Match", "If-Modified-Since", "If-None-Match", 
            "If-Range", "If-Unmodified-Since", "Max-Forwards", "Proxy-Authorization", "Referer", "Range", "Te", "Translate", "User-Agent"
        };

        private static readonly Func<HttpRequestHeader, string> HttpRequestHeaderConverter = h => HttpRequestHeaders[(int)h];

        public HttpRequestHeaderCollection() : 
            this(new Dictionary<string, string>())
        {
        }

        public HttpRequestHeaderCollection(IDictionary<string, string> dictionary) : 
            base(HttpRequestHeaderConverter, dictionary)
        {
        }
    }
}